<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page language="java" import="com.knowledge.model.Comment"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <%List<Comment> commentList = new ArrayList<Comment>();
  Comment c1 = new Comment();
  Comment c2 = new Comment();
  c1.setId("1");c1.setUserId("1");c1.setUserName("王春晖");c1.setContent("hahahahaha 测试1");c1.setAddTime(new Date());
  c2.setId("2");c2.setUserId("2");c2.setUserName("张鹏飞");c2.setContent("ccaocaocao 测试2");c2.setAddTime(new Date());
  commentList.add(c1);
  commentList.add(c2);
  String userId = "1";
  String knowledgeId = "10";
   %>
<link href="css/layout.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/blog.css" rel="stylesheet" type="text/css" media="all" />
<link rel="stylesheet" type="text/css" href="css/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="css/skins/sam/container.css" />
<link rel="stylesheet" type="text/css" href="css/skins/sam/menu.css" />
<link rel="stylesheet" type="text/css" href="css/skins/sam/button.css" />
<link rel="stylesheet" type="text/css" href="css/skins/sam/editor.css" />

<script type="text/javascript" src="js/utilities.js"></script>
<script type="text/javascript" src="js/container-min.js"></script>
<script type="text/javascript" src="js/menu-min.js"></script>
<script type="text/javascript" src="js/button-min.js"></script>
<script type="text/javascript" src="js/editor-min.js"></script>
<script type="text/javascript" src="js/comment.js"></script>

<style>
    .yui-skin-sam .yui-toolbar-container .yui-toolbar-inserticon span.yui-toolbar-icon {
        background-image: url( img/face/face.gif );
        background-position: 1px 0px;
        left: 5px;
    }
    .yui-skin-sam .yui-toolbar-container .yui-button-insertdate-selected span.yui-toolbar-icon {
        background-image: url( img/face/face.gif );
        background-position: 1px 0px;
        left: 5px;
    }
    #inserticon {
        border:1px solid ##BDC7D8;
        padding:5px;
        background-color: #FFFFFF;
    }
    #inserticon a {
        display: block;
        float: left;
        border: 1px solid #F2F2F2;
    }
    #inserticon a:hover {
        border: 1px solid #808080;
    }

</style>

  </head>
  
   <body class="yui-skin-sam">

<div class="main-page">

<div id="comments" >
		<ol class="commentlist"  id="commentlist">
<%for(Comment cmt : commentList){ %>
<li class="even" id="<%=cmt.getId()%>">
	<div class="comment">
		<div class="picture"><a class="usericon" href="<%=cmt.getUserUrl()%>"><img alt="<%=cmt.getUserName()%>" src="<%=cmt.getImgUrl()%>"/></a></div>
		<div class="info"><span class="author"><a href="<%=cmt.getUserUrl()%>"><%=cmt.getUserName()%></a></span>
			<!--别人的评论-->
			<%if(cmt.getUserId().equals(userId)){%>
			<!--自己的评论--><span class="remove"><a href="javascript:void(0)" onclick=delComment(<%=cmt.getId()%>)>删除</a></span>
			<%}else{%>
				<span class="reply"><a href="javascript:void(0)" onclick="reply('<%=cmt.getUserName()%>','<%=cmt.getUserId()%>');  return false;">回复</a></span>
				<%} %>
				<span class="timestamp"><%=cmt.getAddTime()%></span>
			</div>	
		<div class="content"><%=cmt.getContent()%></div>
	</div>
</li>
						
<%} %>
</ol>
                    
</div>
<div id="container"></div>
  <div >          
<form method="post" action="#" id="commentForm">
<textarea id="editor" name="editor" rows="20" cols="75">
</textarea>
<br>
<p class="actions align-left">
<input value="发表评论" class="input-submit" tabindex="4" type="button" onClick="postComment(<%=userId%>,<%=knowledgeId%>)">
</p>
<input id='replierId' value='' type='hidden'>
</form>
</div>		

</div>
  </body>
</html>
